from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
import MyClassModels

def Check_ExamRecordExist(record):
    recordList=MyClassModels.ExamRecordModel.all();
    recordList.filter('CourseName =',record.CourseName);
    recordList.filter('StudentNumber =',record.StudentNumber);
    recordList.filter('ExamName =',record.ExamName);
    if recordList.count()!=0:
        return recordList[0];
    else:
        return None;

def Check_StudentNameByNumber(StudentNumber):
    student=MyClassModels.StudentModel.all();
    student.filter('studentNumber =',StudentNumber);
    if student.count()!=0:
        return student[0];
    else:
        return None;

##from google.appengine.api import users
##from google.appengine.ext import webapp
##from google.appengine.ext.webapp import template
##import MyClassModels
##
##recordList=MyClassModels.ExamRecordModel.all();
##recordList.filter('CourseName =','yuwen');
##recordList.filter('StudentNumber =',1);
##print recordList.count()